package com.souche.employment;

import com.souche.employment.dto.JobDto;
import com.souche.employment.interceptor.LoginInterceptor;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import com.souche.employment.interceptor.TrackInterceptor;

/**
 * 
 * ApplicationStarter.java created at 2017年8月8日 下午1:31:11
 * @author Ray [email:rayinhangzhou@hotmail.com]
 * Revision History
 * Date            Programmer                   Notes
 * ----------------------------------------------------------
 **/
@SpringBootApplication
public class ApplicationStarter extends WebMvcConfigurerAdapter {
	public static void main(String[] args) {
		SpringApplication.run(ApplicationStarter.class, args);
	}
	
	/** 
     * 配置拦截器 
     * @author lance 
     * @param registry 
     */

	@Bean
    TrackInterceptor getTrackInterceptor() {
        return new TrackInterceptor();
    }

    @Bean
    LoginInterceptor getLoginInterceptor() {
	    return new LoginInterceptor();
    }

    public void addInterceptors(InterceptorRegistry registry) {  
        registry.addInterceptor(getTrackInterceptor()).addPathPatterns("/**");
        registry.addInterceptor(getLoginInterceptor()).addPathPatterns("/**").excludePathPatterns("/pub/**").excludePathPatterns("/login");
    }
}
